<style>
.typeitem{	
	text-align:left;
	padding:0.5rem;
	background:#fff;
	background: var(--s-color-bg-primary,#fff);
    border: 1px solid rgba(0,0,0,.08);
    border: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08));
}
.typeitem.active{
    border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
</style>
<div class="fui-tab-scroll" style="padding-bottom:0.5rem;height:2.5rem">
	<div ng-class="{'item':1,'on':!pagedata.params.llm_model}" style="height:2rem;line-height:1.5rem"><a href="javascript:;" ng-click="pagedata.params.llm_model='';tool.get_list('jy_aiagent/index/getmyagent/',true);">全部</a></div>
	<div ng-repeat="(key,title) in pagedata.llm_models2" style="height:2rem;line-height:1.5rem" ng-class="{'item':1,'on':pagedata.params.llm_model==key}"><a href="javascript:;" ng-click="pagedata.params.llm_model=key;tool.get_list('jy_aiagent/index/getmyagent/',true);">{{title}}</a></div>
</div>
<div class="fui-cell-group radius">
	<div ng-repeat="item in pagedata.list" class="fui-cell" style="padding:0.35rem;">
		<div ng-click="pagedata.delagent(item.id)" style="position: absolute;top:0;right:0.5rem">
			<i class="icon icon-jian bold red"></i>
		</div>
		<div class="fui-cell-lable" style="width:auto;padding-right: 0.3rem;">
			<img style="border-radius: 100%;width:3.3rem;height:3.3rem" ng-src="{{tomedia(item.logo) || '../addons/jy_aiagent/resource/images/nv1.png'}}" />
		</div>
		<div class="fui-cell-text" style="">
			<div class="bold">{{item.title}} <i class="icon icon-shuru" style="color:#7783EA;" ng-click="access_json('/editagent//id='+item.id);"></i></div>
			<div class="gray overflow-h">音色：{{item.voice.title}}</div>
			<div class="gray overflow-h">模型：{{item.llm_modeltitle}}</div>
		</div>
		<div class="fui-cell-remark noremark" style="padding-left:0;width:4rem;padding-top: 0.5rem;">
			<div ng-if="!item.isgoodsnum || item.isgoodsnum==0" class="btn btn-sm btn-success" ng-click="pagedata.showpeigoodscode=true;pagedata.post.agentid=item.id" style="background: #eaeef9;color:#7783EA;border-radius:0.2rem">配置到设备</div>
			<div ng-if="item.isgoodsnum>0" class="btn btn-sm btn-success" ng-click="pagedata.showgoodslist=true;pagedata.post.agentid=item.id;pagedata.nowgoodslist=item.goods" style="background: #eaeef9;color:#7783EA;border-radius:0.2rem">设备({{item.isgoodsnum}})台</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showpeigoodscode" class="popup">
	<div class="popup-body">
		<div class="popup-center radius" style="width: 80%;">
		<div class="fui-cell-group" style="margin-top:1rem;-webkit-overflow-scrolling: touch;">
		<div class="c bold">添加设备</div>
		<div class="fui-cell">
		<div class="fui-cell-text c">
			<input type="text" class='fui-input' style="margin-left:0;background: #f2f2f2;" placeholder="请输入设备播报的6位数验证码" ng-model="pagedata.post.code"/>
		</div>
		</div>
		</div>
		<div class="fui-cellone" style="padding-top:0.5rem">
					<div class="fui-cellone-text" style="padding-right:0.5rem">
					<div class="radius c" ng-click="pagedata.showpeigoodscode=false;" style="background:#eaeef9;color:#3263fe;padding:0.5rem">
						取消
					</div>
					</div>	
					<div class="fui-cellone-text">
					<div class="radius c" ng-click="pagedata.peigoodscode()" style="background:#3263fe;color:#fff;padding:0.5rem">
						确定
					</div>
					</div>	
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showgoodslist" class="popup">
	<div class="popup-body">
		<div class="popup-bottom radius">
		<i class="closed icon icon-cuowu" ng-click="pagedata.showgoodslist=false"></i>
		<div class="fui-cell-group radius" style="margin-top:1rem;-webkit-overflow-scrolling: touch;">
			<div ng-repeat="item in pagedata.nowgoodslist" class="fui-cell" style="padding:0.35rem;">
				<div class="fui-cell-text" style="">
					<div class="bold">{{item.goods.title}}</div>
					<div class="bold">{{item.alias||'设备名称'}}</div>
					<div class="gray">Mac地 址：{{item.macsn||'***.***.***.***'}}</div>
					<div class="gray">固件版本：{{item.gu_v||'1.7.2'}}</div>
				</div>
				<div class="fui-cell-remark noremark" style="padding-left:0;width:4rem">
					<div ng-click="pagedata.delgoods(item.id)" class="btn btn-sm btn-success" style="background: #eaeef9;color:#7783EA;border-radius:0.2rem">删除</div>
				</div>
			</div>
			<div class="content-empty" ng-show="!pagedata.nowgoodslist || pagedata.nowgoodslist.length == 0 ">
				<img style="border-radius: 100%;width:2rem;height:2rem" src="../addons/jy_aiagent/resource/images/goods.png" />
				<div style="padding-top:0.3rem;color: #999;font-size: .75rem">您暂时没有设备</div>
			</div>
			<div class="fui-cellone" style="padding-top:0.5rem;padding-bottom:0">
					<div class="fui-cellone-text c">
						<div class="radius c" ng-click="pagedata.showpeigoodscode=true;pagedata.showgoodslist=false" style="background:#3263fe;color:#fff;padding:0.5rem">
							配置新设备
						</div>
					</div>	
			</div>
		</div>
		</div>
	</div>
</div>
<script>
scope.tool.get_list('jy_aiagent/index/getmyagent/',true);
scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_aiagent/index/getmyagent/');
}
scope.pagedata.peigoodscode=function(){
   scope.post_json('jy_aiagent/index/peigoodscode/',scope.pagedata.post);
}
scope.pagedata.delgoods=function(id){
   scope.post_json('jy_aiagent/index/delgoodscode/',{'id':id});
}
scope.pagedata.delagent=function(id){
	scope.confirm({
		'message':'确认要删除智能体吗？删除后将无法找回！',
		'success':function(){
   			scope.post_json('jy_aiagent/index/deluseragent/',{'id':id},);
		},
		'fail':function(){}
	});
}
</script>